import request from '@/utils/request'


/////////////////        工程登记表           ///////////////////////////////
//获取商品列表
export function getGoodsList(params) {
  return request({
    url: `/shopping/goods/`,
    method: 'GET',
    params
  })
}


export function getGoodsCodeList(params) {
  return request({
    url: `/shopping/goods_code_list/`,
    method: 'GET',
    params
  })
}

export function getGoodsById(id) {
  return request({
    url: `/shopping/goods/${id}/`,
    method: 'GET',
  })
}


//添加商品
export function addGoods(data) {
  return request({
    url: '/shopping/goods/',
    method: 'POST',
    data
  })
}

//更新工程数据
export function updateGoods(data) {
  return request({
    url: `/shopping/goods/${data.id}/`,
    method: 'PUT',
    data
  })
}
//删除工程数据
export function delGoods(id) {
  return request({
    url: `/shopping/goods/${id}/`,
    method: 'DELETE',
  })
}
export function delMultiGoods(data) {
  return request({
    url: '/shopping/goods/batch_delete/',
    method: 'DELETE',
    data
  })
}

export function delGoodsImage(id) {
  return request({
    url: `/shopping/goods_image/${id}/`,
    method: 'DELETE',
  })
}


////商品分类

//获取商品分类列表
export function getCategories(params) {
  return request({
    url: '/shopping/category/',
    method: 'GET',
    params
  })
}

//添加工程类型
export function addCategory(data) {
  return request({
    url: '/shopping/category/',
    method: 'POST',
    data
  })
}

//删除工程类型
export function delCartgory(id) {
  return request({
    url: `/shopping/category/${id}/`,
    method: 'DELETE'
  })
}
//更新工程类型
export function updateCartgory(data) {
  return request({
    url: `/shopping/category/${data.id}/`,
    method: 'PUT',
    data
  })
}


/////////////////礼品包///////////////////////////////

export function getGiftPacks(params) {
  return request({
    url: '/shopping/gift_pack/',
    method: 'GET',
    params
  })
}

export function getGiftPackById(id) {
  return request({
    url: `/shopping/gift_pack/${id}/`,
    method: 'GET',
  })
}


//添加礼品包
export function addGiftPack(data) {
  return request({
    url: '/shopping/gift_pack/',
    method: 'POST',
    data
  })
}

//更新礼品包
export function updateGiftPack(data) {
  return request({
    url: `/shopping/gift_pack/${data.id}/`,
    method: 'PUT',
    data
  })
}
//删除礼品包
export function delGiftPack(id) {
  return request({
    url: `/shopping/gift_pack/${id}/`,
    method: 'DELETE',
  })
}
export function delGiftPacks(data) {
  return request({
    url: '/shopping/gift_pack/batch_delete/',
    method: 'DELETE',
    data
  })
}